/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.asseco.mio.codex;

import com.asseco.mio.codex.controllers.AnObjectInt;
import java.util.Date;
import javax.persistence.*;
import org.appfuse.model.BaseObject;
import org.hibernate.annotations.GenericGenerator;

/**
 *
 * @author konstantin.sivakov
 */
@Entity
@Table(name = "INSTITUTION")
public class Institution extends BaseObject {

    private String id;
    private String institutionName;
    private String institutionCode;
    private String institutionDescription;
    private Boolean status = true;
    private Date activeDate;
    private Date passiveDate;
    private String taxNumber;
    private String idNumber;
    private String rkb;


    private String street;
    private String number;
    private Date startDate;
    private Date endDate;
    private Municipality municipality;
    private GeoArea area;
    private Founder founder;
    private Industry industry;

@Id
    @GeneratedValue(generator = "system-uuid")
    @GenericGenerator(name = "system-uuid", strategy = "uuid")
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Column(name = "ACTIVE_DATE")
    @Temporal(value = TemporalType.TIMESTAMP)
    public Date getActiveDate() {
        return activeDate;
    }

    public void setActiveDate(Date activeDate) {
        this.activeDate = activeDate;
    }

    @ManyToOne
    @JoinColumn(name = "AREA_ID")
    public GeoArea getArea() {
        return area;
    }

    public void setArea(GeoArea area) {
        this.area = area;
    }

    @ManyToOne
    @JoinColumn(name = "MUNICIPALITY_ID")
    public Municipality getMunicipality() {
        return municipality;
    }

    public void setMunicipality(Municipality municipality) {
        this.municipality = municipality;
    }

    @Column(name = "END_DATE")
    @Temporal(value = TemporalType.DATE)
    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    @ManyToOne
    @JoinColumn(name = "FOUNDER_ID")
    public Founder getFounder() {
        return founder;
    }

    public void setFounder(Founder founder) {
        this.founder = founder;
    }

    @Column(name = "ID_NUMBER", length = 7)
    public String getIdNumber() {
        return idNumber;
    }

    public void setIdNumber(String idNumber) {
        this.idNumber = idNumber;
    }

    @ManyToOne
    @JoinColumn(name = "INDUSTRY_ID")
    public Industry getIndustry() {
        return industry;
    }

    public void setIndustry(Industry industry) {
        this.industry = industry;
    }

    @Column(name = "INST_CODE", length = 255)
    public String getInstitutionCode() {
        return institutionCode;
    }

    public void setInstitutionCode(String institutionCode) {
        this.institutionCode = institutionCode;
    }

    @Column(name = "INST_DESC", length = 4096)
    public String getInstitutionDescription() {
        return institutionDescription;
    }

    public void setInstitutionDescription(String institutionDescription) {
        this.institutionDescription = institutionDescription;
    }

    @Column(name = "INST_NAME", length = 1000)
    public String getInstitutionName() {
        return institutionName;
    }

    public void setInstitutionName(String institutionName) {
        this.institutionName = institutionName;
    }

    @Column(name = "NUMBER", length = 10)
    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    @Column(name = "PASSIVE_DATE")
    @Temporal(value = TemporalType.DATE)
    public Date getPassiveDate() {
        return passiveDate;
    }

    public void setPassiveDate(Date passiveDate) {
        this.passiveDate = passiveDate;
    }

    @Column(name = "RKB", length = 5)
    public String getRkb() {
        return rkb;
    }

    public void setRkb(String rkb) {
        this.rkb = rkb;
    }

    @Column(name = "START_DATE")
    @Temporal(value = TemporalType.DATE)
    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    @Column(name = "STATUS")
    public Boolean getStatus() {
        return status;
    }

    public void setStatus(Boolean status) {
        this.status = status;
    }

    @Column(name = "STREET", length = 255)
    public String getStreet() {
        return street;
    }

    public void setStreet(String street) {
        this.street = street;
    }

    @Column(name = "TAX_NUMBER", length = 13)
    public String getTaxNumber() {
        return taxNumber;
    }

    public void setTaxNumber(String taxNumber) {
        this.taxNumber = taxNumber;
    }

    @Override
    public String toString() {
        return "Institution{" + "id=" + id + "institutionName=" + institutionName + "institutionCode=" + institutionCode + "institutionDescription=" + institutionDescription + "status=" + status + "activeDate=" + activeDate + "passiveDate=" + passiveDate + "taxNumber=" + taxNumber + "idNumber=" + idNumber + "rkb=" + rkb + "street=" + street + "number=" + number + "startDate=" + startDate + "endDate=" + endDate + "municipality=" + municipality + "area=" + area + "founder=" + founder + "industry=" + industry + '}';
    }

    

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Institution other = (Institution) obj;
        if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) {
            return false;
        }
        if ((this.institutionName == null) ? (other.institutionName != null) : !this.institutionName.equals(other.institutionName)) {
            return false;
        }
        if ((this.institutionCode == null) ? (other.institutionCode != null) : !this.institutionCode.equals(other.institutionCode)) {
            return false;
        }
        if ((this.institutionDescription == null) ? (other.institutionDescription != null) : !this.institutionDescription.equals(other.institutionDescription)) {
            return false;
        }
        if (this.status != other.status) {
            return false;
        }
        if (this.activeDate != other.activeDate && (this.activeDate == null || !this.activeDate.equals(other.activeDate))) {
            return false;
        }
        if (this.passiveDate != other.passiveDate && (this.passiveDate == null || !this.passiveDate.equals(other.passiveDate))) {
            return false;
        }
        if ((this.taxNumber == null) ? (other.taxNumber != null) : !this.taxNumber.equals(other.taxNumber)) {
            return false;
        }
        if ((this.idNumber == null) ? (other.idNumber != null) : !this.idNumber.equals(other.idNumber)) {
            return false;
        }
        if ((this.rkb == null) ? (other.rkb != null) : !this.rkb.equals(other.rkb)) {
            return false;
        }
        if ((this.street == null) ? (other.street != null) : !this.street.equals(other.street)) {
            return false;
        }
        if ((this.number == null) ? (other.number != null) : !this.number.equals(other.number)) {
            return false;
        }
        if (this.startDate != other.startDate && (this.startDate == null || !this.startDate.equals(other.startDate))) {
            return false;
        }
        if (this.endDate != other.endDate && (this.endDate == null || !this.endDate.equals(other.endDate))) {
            return false;
        }
        if (this.municipality != other.municipality && (this.municipality == null || !this.municipality.equals(other.municipality))) {
            return false;
        }
        if (this.area != other.area && (this.area == null || !this.area.equals(other.area))) {
            return false;
        }
        if (this.founder != other.founder && (this.founder == null || !this.founder.equals(other.founder))) {
            return false;
        }
        if (this.industry != other.industry && (this.industry == null || !this.industry.equals(other.industry))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 59 * hash + (this.id != null ? this.id.hashCode() : 0);
        hash = 59 * hash + (this.institutionName != null ? this.institutionName.hashCode() : 0);
        hash = 59 * hash + (this.institutionCode != null ? this.institutionCode.hashCode() : 0);
        hash = 59 * hash + (this.institutionDescription != null ? this.institutionDescription.hashCode() : 0);
        hash = 59 * hash + (this.status != null ? this.status.hashCode() : 0);
        hash = 59 * hash + (this.activeDate != null ? this.activeDate.hashCode() : 0);
        hash = 59 * hash + (this.passiveDate != null ? this.passiveDate.hashCode() : 0);
        hash = 59 * hash + (this.taxNumber != null ? this.taxNumber.hashCode() : 0);
        hash = 59 * hash + (this.idNumber != null ? this.idNumber.hashCode() : 0);
        hash = 59 * hash + (this.rkb != null ? this.rkb.hashCode() : 0);
        hash = 59 * hash + (this.street != null ? this.street.hashCode() : 0);
        hash = 59 * hash + (this.number != null ? this.number.hashCode() : 0);
        hash = 59 * hash + (this.startDate != null ? this.startDate.hashCode() : 0);
        hash = 59 * hash + (this.endDate != null ? this.endDate.hashCode() : 0);
        hash = 59 * hash + (this.municipality != null ? this.municipality.hashCode() : 0);
        hash = 59 * hash + (this.area != null ? this.area.hashCode() : 0);
        hash = 59 * hash + (this.founder != null ? this.founder.hashCode() : 0);
        hash = 59 * hash + (this.industry != null ? this.industry.hashCode() : 0);
        return hash;
    }



    

    
}
